<div id="content">
    <div id="main_content" class="fixed clear">
	<?php 
		if (!Yii::app()->user->isGuest) { 
			echo '<br />';
			$this->widget('application.components.Categories_User'); 
			echo '<br />';
		} 
	?>
    <span class="col_title">Recent Works</span>
        <table class="job_list" width="100%">
            <thead>
                <th width="30%">Tên dự án</th>
                <th width="15%">Ngành</th>
                <th width="5%">Bid(s)</th>
                <th width="20%">Khoảng tiền</th>
                <th width="20%">Yêu cầu</th>
                <th width="5%">Start</th>
                <th width="5%">End</th>
            </thead>
            <tbody>
			<?php 
				foreach ($model as $key):
					if($key->status == 2) {
						$countBid = Bidjob::model()->countByAttributes(array('job_id'=>$key->id));
			?> 
                <tr>
                    <td><?php echo CHtml::link(substr($key->name, 0, 50), array('job/view', 'id'=>$key->id)); ?></td>
                    <td>
						<?php					
							$jobtype = new Job();
							echo $jobtype->getJob($key->subjobtype_id);
						?>
					</td>
                    <td><?php echo $countBid; ?></td>

                    <td><?php echo $key->budget->money;?></td>
					
                    <td><?php echo $key->skillsrequired;?></td>
                    <td>Today</td>
                    <td>5days</td>
                </tr>
				<?php } ?>
			<?php endforeach; ?>
            </tbody>
        </table>
		<?php
			$this->widget("CLinkPager", array('pages'=>$page));
		?>
<!--CATEGORIES BEGIN-->

<?php if (Yii::app()->user->isGuest) { $this->widget('application.components.Categories'); } ?>

<!--CATEGORIES END-->
    
    <div class="job_button" style="text-align: center;">
        <a href="index.php?r=job/create" class="is_button">Post a new Project</a>
        <a href="index.php?r=users/create" class="is_button">Sign Up Now for Free</a>
        <p class="clear"></p>
    </div>
    </div>
</div>
